/*
 * Write a C++ program to sort the set of numbers in
 * descending order
 */

# include <iostream>
using namespace std;

class Descending {
  int size, temp, i, j;
  int a[100];
public:
  void get();
  void sortDesc();
  void display();
};

void Descending::get() {
  cout << "Enter the size of array: ";
  cin >> size;
  for(i = 0; i < size; i++) {
    cout << "Enter arry element no." << i+1 << ": ";
    cin >> a[i];
  }
}

void Descending::sortDesc() {
  for(i = 0; i < size; i++) {
    for(j = 0; j < size; j++) {
      if(a[i] > a[j]) {
        temp = a[i];
        a[i] = a[j];
        a[j] = temp;
      }
    }
  }
}

void Descending::display() {
  cout << "\nNow the Array is: [ ";
  for(i = 0; i < size; i++) {
    cout << a[i] << " ";
  }
  cout << "]\n";
}

int main() {
  Descending ds;
  ds.get();
  ds.display();
  cout << "\nSorting in descending order...\n";
  ds.sortDesc();
  ds.display();
  return 0;
}
 
